<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List, java.util.Map, java.util.LinkedHashMap, java.util.Iterator" %>
<%@ page import="com.xyrj.html.HHHtml" %>
<%@ page import="system.config.HHConfig" %>
<jsp:include page="common/header.jsp" />
<link rel="stylesheet" href="<%=HHConfig.SITE_URL + "/" + HHConfig.TPL_PATH%>/render/lightbox/jquery.lightbox-0.5.css" />
</head>
    <body>
    <div id="body-wrapper"> <!-- Wrapper for the radial gradient background -->
        <jsp:include page="common/sidebar.jsp"></jsp:include>
        
        <div id="main-content"> <!-- Main Content Section with everything -->
           
		    <!-- 导入不支持Javascript提示 -->	
            <jsp:include page="common/noscript.html" /> 
 	
            <!-- 导入控制面板 -->
            <jsp:include page="common/dashboard.jsp" />
            <div class="clear"></div> <!-- End .clear -->
            
            <div class="content-box"><!-- Start Content Box -->
                
                <div class="content-box-header">
                    <h3><%=request.getAttribute("modelZhName") %></h3>
                </div> <!-- End .content-box-header -->
                
                <% String modelEnName      = (String)request.getAttribute("modelEnName"); %>
                <div class="content-box-content">
                    
                    <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
                        
                        <div class="notification attention png_bg">
                            <a href="#" class="close"><img src="<%=HHConfig.SITE_URL + "/" + HHConfig.TPL_PATH %>/admin/images/icons/cross_grey_small.png" title="关闭提示" alt="关闭" /></a>
                        <div>提示信息～ </div>
                        </div>
                        <form name="list_form" id="list_form_id" action="<%=HHConfig.SITE_URL %>/index.jsp/admin/<%=modelEnName %>/operation" method="POST">
                            <table>
                                <thead>
                                    <tr>
                                       <th><input class="check-all" type="checkbox"/></th>
                                       <%
                                            List<Map> list          = (List<Map>)request.getAttribute("list");
                                            String [] showFields    = (String[])request.getAttribute("showFields"); 
                                            String [] showFieldNames= (String[])request.getAttribute("showFieldNames");
                                            int totalCol            = 2 + showFields.length;
                                       %>
                                       <% for(String name : showFieldNames) { %>
                                       <th><%=name %></th>
                                       <% } %>
                                       <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="record_list_area_id">
                                    <% if(null == list || 0 == list.size()) { %>
                                    <tr><td class='txt-center-bold' colspan='<%=totalCol %>'>暂无记录</td></tr>
                                    <%
                                        }
                                        for(int i = 0; null != list && i < list.size(); i ++) {
                                            Map record  = list.get(i);
                                    %>
                                    <tr>
                                        <td><input type="checkbox" name="record_id" value="<%=record.get(modelEnName + "_id")%>"/></td>
                                        <% for(String field : showFields) { %>
                                        <td><%=HHHtml.formatFieldValue(field, record.get(field))%></td>
                                        <% } %>
                                        <td>
                                            <!-- Icons -->
                                             <a href="<%=HHConfig.SITE_URL %>/index.jsp/admin/<%=modelEnName %>/editview?id=<%=record.get(modelEnName + "_id") %>" title="编辑">
                                                 <img src="<%=HHConfig.SITE_URL + "/" + HHConfig.TPL_PATH %>/admin/images/icons/pencil.png" alt="编辑记录" />
                                             </a>
                                             <a href="<%=HHConfig.SITE_URL %>/index.jsp/admin/<%=modelEnName %>/delete?id=<%=record.get(modelEnName + "_id") %>" title="删除">
                                                 <img src="<%=HHConfig.SITE_URL + "/" + HHConfig.TPL_PATH %>/admin/images/icons/cross.png" alt="删除记录" />
                                             </a> 
                                        </td>
                                    </tr>
                                    <% } %>
                               </tbody>
                                <tfoot>
                                    <tr>
                                        <td colspan="<%=totalCol%>">
                                            <div class="bulk-actions align-right">
                                                <select name="operation" id="operation_id">
                                                    <option value="">选择操作项目</option>
                                                <%
                                                    Map<String, String> oprations   = (LinkedHashMap<String, String>)request.getAttribute("oprations");
                                                    Iterator iterator               = oprations.keySet().iterator();
                                                    while(iterator.hasNext()) {
                                                        String value    = (String)iterator.next();
                                                %>
                                                    <option value="<%=value %>"><%=oprations.get(value) %></option>
                                                <% } %>
                                                </select>
                                                <a class="button" href="javascript:void(0);" id="exec_operation_id">执行操作</a>
                                            </div>
                                            <div class="pagination">
                                                <%=request.getAttribute("pageHtml") %>
                                            </div> <!-- End .pagination -->
                                            <div class="clear"></div>
                                        </td>
                                    </tr>
                                </tfoot>
                            </table>
                        </form>
                    </div> <!-- End #tab1 -->
                   
                </div> <!-- End .content-box-content -->
                
            </div> <!-- End .content-box -->
	<script type="text/javascript" src="<%=HHConfig.SITE_URL + "/" + HHConfig.TPL_PATH%>/render/lightbox/jquery.lightbox-0.5.min.js"></script>
	<script type="text/javascript" src="<%=HHConfig.SITE_URL + "/" + HHConfig.TPL_PATH%>/common/js/hhjslib.hhbindrender.js"></script>
    <script type="text/javascript" src="<%=HHConfig.SITE_URL + "/" + HHConfig.TPL_PATH %>/admin/js/list_form.js"></script>
<jsp:include page="common/footer.jsp" />
